import { IResponse } from './index.type'
import { IBrand } from './home.type'

//  findAllCategory and findCurrentCategory commons api type
export interface ICurCategory {
  id: string
  name: string
  picture: string | null
  children: ISubCategory[]
}

export type ICurCategoryResponse = IResponse<ICurCategory>

// findAllCategory api type
export interface IGoods {
  desc: string
  discount: number
  id: string
  name: string
  orderNum: number
  picture: string
  price: string
}
export interface ICategory {
  open?: boolean
  id: string
  name: string
  children: ICategory[] | null
  goods: IGoods[] | null
  picture: string
}

export type ICategoryResponse = ICategory[]

// findSubCategory api type
export interface IProperty {
  id: string
  name: string
}

export interface ISaleProperty {
  id: string
  name: string
  properties: IProperty[]
}

export interface ISameLevelCategory {
  id: string
  name: string
  layer: number
  parent: null | ISameLevelCategory
}

export interface ISubCategory {
  id: string
  name: string
  picture: string
  parentId: null | string
  parentName: null | string
  goods: IGoods[]
  categories: ISameLevelCategory[]
  brands: null | IBrand[]
  saleProperties: null | ISaleProperty[]
}

export type ISubCategoryResponse = IResponse<ISubCategory>

//
